import { IPSEditor } from '../ipseditor';
import { IPSSearchBarFilter } from './ipssearch-bar-filter';
import { PSSysSearchBarItemImplBase } from './pssys-search-bar-item-impl-base';
import { IPSDEFSearchMode } from '../../dataentity/defield/ipsdefsearch-mode';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysCss } from '../../res/ipssys-css';
import { IPSSysImage } from '../../res/ipssys-image';

export class PSSysSearchBarFilterImpl extends PSSysSearchBarItemImplBase implements IPSSearchBarFilter {
  protected cappslanguageres: IPSLanguageRes | null = null;

  getCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.cappslanguageres != null) return this.cappslanguageres;
    const value = this.M.getCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.cappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getCapPSLanguageRes') as IPSLanguageRes;
    return this.cappslanguageres;
  }

  get capPSLanguageRes(): IPSLanguageRes | null {
    return this.getCapPSLanguageRes();
  }

  getCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定标题多语言资源对象');
    }
    return value;
  }

  get caption(): string {
    return this.M.caption;
  }

  get createDV(): string {
    return this.M.createDV;
  }

  get createDVT(): 'SESSION' | 'APPLICATION' | 'UNIQUEID' | 'CONTEXT' | 'PARAM' | 'OPERATOR' | 'OPERATORNAME' | 'CURTIME' | 'APPDATA' {
    return this.M.createDVT;
  }

  get dataType(): 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 {
    return this.M.dataType;
  }

  get itemHeight(): number {
    return this.M.itemHeight != null ? this.M.itemHeight : 0.0;
  }

  get itemWidth(): number {
    return this.M.itemWidth != null ? this.M.itemWidth : 0.0;
  }

  get labelCssStyle(): string {
    return this.M.labelCssStyle;
  }

  get labelPos(): 'LEFT' | 'TOP' | 'RIGHT' | 'BOTTOM' | 'NONE' {
    return this.M.labelPos;
  }

  get labelWidth(): number {
    return this.M.labelWidth;
  }

  get outputCodeListConfigMode(): 0 | 1 | 2 {
    return this.M.outputCodeListConfigMode != null ? this.M.outputCodeListConfigMode : 0;
  }

  protected phpslanguageres: IPSLanguageRes | null = null;

  getPHPSLanguageRes(): IPSLanguageRes | null {
    if (this.phpslanguageres != null) return this.phpslanguageres;
    const value = this.M.getPHPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.phpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getPHPSLanguageRes') as IPSLanguageRes;
    return this.phpslanguageres;
  }

  get pHPSLanguageRes(): IPSLanguageRes | null {
    return this.getPHPSLanguageRes();
  }

  getPHPSLanguageResMust(): IPSLanguageRes {
    const value = this.getPHPSLanguageRes();
    if (value == null) {
      throw new Error('未指定输入提示语言资源');
    }
    return value;
  }

  protected psdefsearchmode: IPSDEFSearchMode | null = null;

  getPSDEFSearchMode(): IPSDEFSearchMode | null {
    if (this.psdefsearchmode != null) return this.psdefsearchmode;
    const value = this.M.getPSDEFSearchMode;
    if (value == null) {
      return null;
    }
    this.psdefsearchmode = this.getPSModel4('dataentity.defield.IPSDEFSearchMode', value, 'getPSDEFSearchMode') as IPSDEFSearchMode;
    return this.psdefsearchmode;
  }

  get psDEFSearchMode(): IPSDEFSearchMode | null {
    return this.getPSDEFSearchMode();
  }

  getPSDEFSearchModeMust(): IPSDEFSearchMode {
    const value = this.getPSDEFSearchMode();
    if (value == null) {
      throw new Error('未指定属性搜索模式');
    }
    return value;
  }

  protected pseditor: IPSEditor | null = null;

  getPSEditor(): IPSEditor | null {
    if (this.pseditor != null) return this.pseditor;
    const value = this.M.getPSEditor;
    if (value == null) {
      return null;
    }
    this.pseditor = this.getPSModel4('control.IPSEditor', value, 'getPSEditor') as IPSEditor;
    return this.pseditor;
  }

  get psEditor(): IPSEditor | null {
    return this.getPSEditor();
  }

  getPSEditorMust(): IPSEditor {
    const value = this.getPSEditor();
    if (value == null) {
      throw new Error('未指定编辑器对象');
    }
    return value;
  }

  protected pssyscss: IPSSysCss | null = null;

  getPSSysCss(): IPSSysCss | null {
    if (this.pssyscss != null) return this.pssyscss;
    const value = this.M.getPSSysCss;
    if (value == null) {
      return null;
    }
    this.pssyscss = this.getPSModel4('res.IPSSysCss', value, 'getPSSysCss') as IPSSysCss;
    return this.pssyscss;
  }

  get psSysCss(): IPSSysCss | null {
    return this.getPSSysCss();
  }

  getPSSysCssMust(): IPSSysCss {
    const value = this.getPSSysCss();
    if (value == null) {
      throw new Error('未指定过滤项界面样式表');
    }
    return value;
  }

  protected pssysimage: IPSSysImage | null = null;

  getPSSysImage(): IPSSysImage | null {
    if (this.pssysimage != null) return this.pssysimage;
    const value = this.M.getPSSysImage;
    if (value == null) {
      return null;
    }
    this.pssysimage = this.getPSModel4('res.IPSSysImage', value, 'getPSSysImage') as IPSSysImage;
    return this.pssysimage;
  }

  get psSysImage(): IPSSysImage | null {
    return this.getPSSysImage();
  }

  getPSSysImageMust(): IPSSysImage {
    const value = this.getPSSysImage();
    if (value == null) {
      throw new Error('未指定项图片对象');
    }
    return value;
  }

  get resetItemName(): string {
    return this.M.resetItemName;
  }

  get unitName(): string {
    return this.M.unitName;
  }

  get unitNameWidth(): number {
    return this.M.unitNameWidth != null ? this.M.unitNameWidth : 0;
  }

  get valueItemName(): string {
    return this.M.valueItemName;
  }

  get width(): number {
    return this.M.width != null ? this.M.width : 0.0;
  }

  get addSeparator(): boolean {
    return this.M.addSeparator != null ? this.M.addSeparator : false;
  }

  get allowEmpty(): boolean {
    return this.M.allowEmpty;
  }

  get convertToCodeItemText(): boolean {
    return this.M.convertToCodeItemText != null ? this.M.convertToCodeItemText : false;
  }

  get emptyCaption(): boolean {
    return this.M.emptyCaption;
  }

  get enableItemPriv(): boolean {
    return this.M.enableItemPriv != null ? this.M.enableItemPriv : false;
  }

  get enableUnitName(): boolean {
    return this.M.enableUnitName != null ? this.M.enableUnitName : false;
  }

  get hidden(): boolean {
    return this.M.hidden;
  }

  get needCodeListConfig(): boolean {
    return this.M.needCodeListConfig != null ? this.M.needCodeListConfig : false;
  }

  get showCaption(): boolean {
    return this.M.showCaption;
  }

  get cls(): string {
    return 'PSSysSearchBarFilterImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.searchbar.IPSSearchBarFilter') return true;
    return super.instanceof(cls);
  }
}
